package org.example.service;

import org.example.domain.Novel;
import org.example.mapper.NovelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p> Novel </p>
 *
 * @author Chris
 * @since 2022/10/29 17:33
 */
@Service
public class NovelService {

    @Autowired
    private NovelMapper novelMapper;

    public List<Novel> listNovel(Novel novel) {
        return novelMapper.listNovels(novel);
    }


    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
    public void save(Novel novel) {
        novelMapper.save(novel);

        int a = 1 / 0;

    }

}